<template>
  <u-container-layout>
    <zlrt-table :p="ctx">
      <template #before>
        <zlrt-search :p="ctx">
        </zlrt-search>
        <div class="tool-bar">
          <el-button type="danger" v-hasPermit="['wms-warehouse:in-out-log:del']" icon="Delete"
            :disabled="!ctx.selected.length" @click="ctx.batchDelete()">
            批量删除
          </el-button>
          <span style="float:right">
            <el-button type="success" v-hasPermit="['wms-warehouse:in-out-log:list']" :loading="ctx.exportLoading"
              icon="Download" @click="ctx.export()">
              导出
            </el-button>
            <!-- <el-button type="primary" v-hasPermit="['wms-warehouse:in-out-log:save']" icon="Plus" @click="ctx.showEdit()">
              添加
            </el-button> -->
          </span>
        </div>
      </template>
      <template #operate="scope">
        {{ parseInt(scope.row.operate) < 0 ? '出库' : '入库' }} </template>
          <template #after>
            <el-dialog v-model="ctx.editVisible" :title="ctx.editAction + ctx.title" width="600px" append-to-body
              :close-on-click-modal="false" @close="ctx.closeEdit()">
              <el-form :ref="(e) => ctx.formRef = e" :model="ctx.editData" :rules="ctx.rules"
                v-loading="ctx.editLoading" label-width="120px" class="demo-ruleForm">
                <el-form-item label="仓库" prop="warehouseId">
                  <el-select v-model="ctx.editData.warehouseId" placeholder="请选择仓库" @change="ctx.other.handleWarehouse">
                    <el-option v-for="item in warehouseOptions" :key="item.id" :label="item.name" :value="item.id">
                    </el-option>
                  </el-select>
                </el-form-item>
                <el-form-item label="货主" prop="ownerId">
                  <el-select v-model="ctx.editData.ownerId" placeholder="请选择货主" @change="ctx.other.handleOwner">
                    <el-option v-for="item in ownerOptions" :key="item.id" :label="item.name" :value="item.id">
                    </el-option>
                  </el-select>
                </el-form-item>
                <el-form-item label="商品编码" prop="barCode">
                  <el-input v-model="ctx.editData.barCode" placeholder="请输入商品编码" />
                </el-form-item>
                <el-form-item label="商品名称" prop="skuName">
                  <el-input v-model="ctx.editData.skuName" placeholder="请输入商品名称" />
                </el-form-item>
                <el-form-item label="sku" prop="skuCode">
                  <el-input v-model="ctx.editData.skuCode" placeholder="请输入sku" />
                </el-form-item>
                <el-form-item label="订单类型" prop="orderType">
                  <el-input v-model="ctx.editData.orderType" placeholder="请输入订单类型" />
                </el-form-item>
                <el-form-item label="单价（¥）" prop="price">
                  <el-input v-model="ctx.editData.price" placeholder="请输入单价（¥）" />
                </el-form-item>
                <el-form-item label="数量" prop="number">
                  <el-input v-model="ctx.editData.number" placeholder="请输入数量" />
                </el-form-item>
                <el-form-item label="商品规格型号" prop="specification">
                  <el-input v-model="ctx.editData.specification" placeholder="请输入商品规格型号" />
                </el-form-item>
                <el-form-item label="保质期" prop="termValidity">
                  <el-input v-model="ctx.editData.termValidity" placeholder="请输入保质期" />
                </el-form-item>
                <el-form-item label="计量单位" prop="unit">
                  <el-input v-model="ctx.editData.unit" placeholder="请输入计量单位" />
                </el-form-item>
              </el-form>
              <template #footer>
                <span class="dialog-footer">
                  <el-button @click="ctx.editVisible = false">取消</el-button>
                  <el-button type="primary" @click="ctx.save()">确定</el-button>
                </span>
              </template>
            </el-dialog>
          </template>
    </zlrt-table>
  </u-container-layout>
</template>

<script lang="ts" src="./log" />

<style lang="scss" scoped>

</style>
